import {createSlice} from "@reduxjs/toolkit";

const carSlice = createSlice({
    name: "car",
    initialState: {
        carList: [
            {
                id: 1,
                name: "购物车1",
                price: 10,
            }
        ],
    },
    reducers: {
        addCarList(state, {payload}) {
            state.carList.unshift(payload)
        }
    }
})

export const {addCarList} = carSlice.actions
export default carSlice.reducer